package com.hunktimes.wholesale.ui.tabs.me

import android.os.Bundle
import android.view.View
import androidx.core.os.bundleOf
import androidx.fragment.app.viewModels
import androidx.navigation.navOptions
import com.hunktimes.wholesale.R
import com.hunktimes.wholesale.base.BaseMainFragment
import com.hunktimes.wholesale.databinding.FragmentMeBinding
import com.hunktimes.wholesale.util.Constants

class MeFragment : BaseMainFragment(R.layout.fragment_me) {

    private val meViewModel by viewModels<MeViewModel>()
    lateinit var viewBinding: FragmentMeBinding
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        viewBinding = FragmentMeBinding.bind(view)
    }

    override fun onStart() {
        super.onStart()
        viewBinding.collectionRow.setOnClickListener {
            rootNavController.navigate(R.id.navigation_collection)
        }
        viewBinding.orderAllTv.setOnClickListener {
            rootNavController.navigate(R.id.navigation_my_order)
        }
        viewBinding.toPay.setOnClickListener {
            val bundle = bundleOf(Constants.key_selected_tab to 1)
            rootNavController.navigate(R.id.navigation_my_order, bundle)
        }
        viewBinding.toDeliver.setOnClickListener {
            val bundle = bundleOf(Constants.key_selected_tab to 2)
            rootNavController.navigate(R.id.navigation_my_order, bundle)
        }
        viewBinding.toReceive.setOnClickListener {
            val bundle = bundleOf(Constants.key_selected_tab to 3)
            rootNavController.navigate(R.id.navigation_my_order, bundle)
        }
        viewBinding.toComment.setOnClickListener {
            val bundle = bundleOf(Constants.key_selected_tab to 4)
            rootNavController.navigate(R.id.navigation_my_order, bundle)
        }
        viewBinding.titleBar.setOnClickListener {
            rootNavController.navigate(R.id.navigation_member_info)
        }
        viewBinding.customerServiceRow.setOnClickListener {
            rootNavController.navigate(R.id.navigation_protocol)
        }
        viewBinding.paymentRow.setOnClickListener {
            rootNavController.navigate(R.id.navigation_payment)
        }

    }
}